package cj.web.kly.dao;
/*
 *  
 *  
*/
import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.kly.domain.SubjectColumns;

/**
 * 
 * @author 
 *
 */
@DAO
public interface SubjectColumnsDAO{
	
	@SQL("SELECT * FROM SubjectColumns WHERE deleteFlag=1 and status=1 and subjectId=:1 order by orderNo ")
    List<SubjectColumns> queryAll(int subjectId);
	
	@SQL("SELECT * FROM SubjectColumns WHERE deleteFlag=1 #if(:t.name != null){ AND name LIKE '%##(:t.name)%' } ORDER BY updateAt DESC LIMIT :t.start,:t.length ")
    List<SubjectColumns> query(@SQLParam("t") SubjectColumns subjectColumns);
	
	@SQL("SELECT COUNT(1) FROM SubjectColumns WHERE deleteFlag=1 #if(:t.name != null){ AND name LIKE '%##(:t.name)%' } ")
    int querySize(@SQLParam("t") SubjectColumns subjectColumns);
    
    @SQL("SELECT * FROM SubjectColumns WHERE id=:1 ")
    SubjectColumns queryById(int id);
    
    @SQL("INSERT INTO SubjectColumns (pId,subjectId,name,descs,value,status,orderNo,deleteFlag,createUser,createAt,updateUser,updateAt) VALUES (:t.pId,:t.subjectId,:t.name,:t.descs,:t.value,1,:t.orderNo,1,:t.createUser,now(),:t.updateUser,now()) ")
    void create(@SQLParam("t") SubjectColumns subjectColumns);
	
	@SQL("UPDATE SubjectColumns SET pId=:t.pId,subjectId=:t.subjectId,name=:t.name,descs=:t.descs,value=:t.value,orderNo=:t.orderNo,updateUser=:t.updateUser,updateAt=now() WHERE id=:t.id ")
    void update(@SQLParam("t") SubjectColumns subjectColumns);
    
    @SQL("UPDATE SubjectColumns SET deleteFlag=0 WHERE id=:1 ")
    void deleteById(int id);
}